#定义变量

# -g 开启gdb的debug调试 （生成的二进制文件中包含调试信息）
# -O0 关闭优化
# -Wall 开启所有的警告

log :=thirdparty/log/log.c thirdparty/log/log.h
log_test: test/log_test.c $(log)
	-gcc $^ -o $@ -I thirdparty
	-./$@
	-rm $@

json:=thirdparty/cJSON/cJSON.h thirdparty/cJSON/cJSON.c
cjson_test: test/cjson_test.c $(log) $(json)
	-gcc $^ -o cjson_test -I thirdparty
	-./$@
	-rm $@

App_common:=App/App_Common.c App/App_Common.h
App_common_test: test/App_Common_test.c $(App_common) $(log)
	-gcc $^ -o $@ -I thirdparty -I App
	-./$@
	-rm $@


App_Message :=App/App_message.c App/App_message.h
App_Message_test: test/App_Message_test.c $(App_Message) $(App_common) $(log) $(json)
	-gcc $^ -o $@ -I thirdparty -I App
	-./$@
	-rm $@

mqtt_test: test/mqtt_test.c
	-gcc $^ -o $@ -l paho-mqtt3c
	-./$@
	-rm $@

App_mqtt :=App/App_mqtt.c App/App_mqtt.h
App_mqtt_test: test/App_mqtt_test.c $(App_mqtt) $(log) 
	-gcc $^ -o $@ -I App -I thirdparty -l paho-mqtt3c
	-./$@
	-rm $@

App_Pool :=App/App_Pool.c App/App_Pool.h
App_Pool_test: test/App_Pool_test.c $(App_Pool) $(log) 
	-gcc $^ -o $@ -I App -I thirdparty 
	-./$@
	-rm $@
App_buffer:= App/App_Buffer.h App/App_Buffer.c
App_buffer_test: test/App_Buffer_test.c $(App_buffer) $(log)
	-$(CC) $^ -o $@ -I App -I thirdparty
	-./$@
	-rm $@

App_BT:=App/App_BT.c App/App_BT.h
App_Device:=App/App_Device.c App/App_Device.h
App_Device_test: test/App_Device_test.c $(App_BT) $(App_Device) $(log) $(App_buffer) $(App_Message) $(App_common) $(App_Pool) $(App_mqtt) $(json)
	-gcc $^ -o $@ -I App -I thirdparty -lpaho-mqtt3c
	-./$@
	-rm $@

    
# -I 给gcc指定include path
# $^ 表示所有的依赖文件
# $@ 表示目标文件
